import https from "./https"

class Order extends https{
	getDefaultAddress(is_default=1){//获取默认地址
		return this.request.post("/plugin/member/api_ship_address/addressList", {
		   'proof': uni.getStorageSync('token'),is_default
		});
	}
	createOrder(){
		return this.request.post("/plugin/order/api_create_order/createMemberOrderNum", {//创建一次性订单
		   'proof': uni.getStorageSync('token')
		});
	}
	getOrderGoods(sku,num){
		return this.request.post("/plugin/order/api_create_order/OrderSubmit", {//提交订单详情
		   'proof': uni.getStorageSync('token'),sku,num
		});
	}
	getFright(provice,goods_id,goods_num){
		return this.request.post("/plugin/order/api_select_order/countFreight", {//计算运费
		   'proof': uni.getStorageSync('token'),provice,goods_id,goods_num
		});
	}
	createMemberOrder(order_member_num,order_store_id,order_goods_num,order_goods_sku,consignee_id,remark,store_redeem_code,redeem_code){
		return this.request.post("/plugin/order/api_create_order/createMemberOrder", {//创建订单
		   'proof': uni.getStorageSync('token'),
		   order_member_num,order_store_id,order_goods_num,order_goods_sku,consignee_id,remark,store_redeem_code,redeem_code,
		   'order':{order_type:1,order_source:1}
		});
	}
	getOrderList(order_status,page,page_size){
		return this.request.post("/plugin/order/api_select_order/order_list", {//订单列表
		   'proof': uni.getStorageSync('token'),order_status,page,page_size
		});
	}
	orderDetails(order_num){
		return this.request.post("/plugin/order/api_select_order/order_detail", {//订单详情
		   'proof': uni.getStorageSync('token'),order_num
		});
	}
	deleteOrder(order_num){
		return this.request.post("/plugin/order/api_edit_order/delOrder", {//删除订单
		   'proof': uni.getStorageSync('token'),order_num
		});
	}
	cancelOrder(order_num){
		return this.request.post("/plugin/order/api_edit_order/cancelOrder", {//取消订单
		   'proof': uni.getStorageSync('token'),order_num
		});
	}
	RemindDelivery(order_num){
		return this.request.post("/plugin/order/api_edit_order/RemindDelivery", {//提醒发货
		   'proof': uni.getStorageSync('token'),order_num
		});
	}
	payOrder(order_member_num,pay_type,pay_password,type){
		if(type){
			return this.request.post("/plugin/order/api_pay_order/orderPayment", {//列表支付订单
			   'proof': uni.getStorageSync('token'),'order_num':order_member_num,pay_type,pay_password
			});
		}else{
			return this.request.post("/plugin/order/api_pay_order/MemberOrderPayment", {//支付订单
			   'proof': uni.getStorageSync('token'),order_member_num,pay_type,pay_password
			});
		}
	}
	receipt(order_num){
		return this.request.post("/plugin/order/api_edit_order/confirmReceipt", {
		   'proof': uni.getStorageSync('token'),order_num
		});
	}
	getpaylist(){
		return this.request.post("/plugin/pay/api_common/getpaylist",{
		   'proof': uni.getStorageSync('token')
		});
	}
	delCart(sku){//删除购物车商品
	    return this.request.post("/plugin/goods/api_shopping_trolley/delShoppingTrolley", {
	       'proof': uni.getStorageSync('token'),sku
	    });
	}
	orderPayment(order_num){//获取支付流水号
	    return this.request.post("/plugin/order/api_pay_order/orderPayment", {
	       'proof': uni.getStorageSync('token'),order_num
	    });
	}
	pay(order_num,pay_type,pay_password){//支付
	    return this.request.post("/plugin/order/api_pay_order/orderPay", {
	       'proof': uni.getStorageSync('token'),order_num,pay_type,pay_password
	    });
	}
	comment(params){//评价
		params = Object.assign({'proof': uni.getStorageSync('token')},params)
	    return this.request.post("/plugin/goods/api_goods_comment/comment",params);
	}
	query(order_num){//物流信息
	    return this.request.post("/plugin/logistics/api_index/query",{
			'proof': uni.getStorageSync('token'),order_num
		});
	}
	orderRefund(order_num,cause,remark,voucher){//申请售后
	    return this.request.post("/plugin/order/api_edit_order/orderRefund",{
			'proof': uni.getStorageSync('token'),order_num,cause,remark,voucher
		});
	}
	orderRefundList(page,pagesize){//售后列表
	    return this.request.post("/plugin/order/api_edit_order/orderRefundList",{
			'proof': uni.getStorageSync('token'),page,pagesize
		});
	}
	orderRefundCancel(order_num){//取消售后申请
	    return this.request.post("/plugin/order/api_edit_order/orderRefundCancel",{
			'proof': uni.getStorageSync('token'),order_num
		});
	}
	finance_money(finance_type){//余额
	    return this.request.post("/plugin/finance/api_index/finance_money", {
			'proof': uni.getStorageSync('token'),finance_type
	    });
	}
	chooseCoupon(type,sku,num,store_id){//可用优惠劵列表
	    return this.request.post("/plugin/marketing/api_marketing/storeCouponList", {
			'proof': uni.getStorageSync('token'),store_id,sku,num,type
	    });
	}
	useCoupon(store_info,choose){//选择(使用)优惠劵
	    return this.request.post("/plugin/marketing/api_marketing/getCouponList", {
			'proof': uni.getStorageSync('token'),store_info,choose
	    });
	}
	checkPayPassword(pay_password){//检查支付密码
		return this.request.post("/plugin/finance/api_index/checkPayPassword", {
			proof:uni.getStorageSync('token'),
			pay_password,
			"finance_type":"member",
		});	
	}
}
export default Order
